// #include <bits/stdc++.h>

// using namespace std;

// double eps;

// int main()
// {
//     #define int long long

//     cerr << "n=" << endl;
//     int n;
//     cin >> n;
//     cerr << "capacity=" << endl;
//     long long cap;
//     cin >> cap;
//     cerr << "classes=" << endl; // >= 2
//     int classes;
//     cin >> classes;
//     classes--;  
//     cerr << "fraction=" << endl; // 0<=frac<=1, in practice frac should be quite a lot smaller than 1
//     double frac;
//     cin >> frac;
//     cerr << "eps=" << endl;
//     double eps;
//     cin >> eps;
//     cerr << "small=" << endl;
//     long long small;
//     cin >> small;

//     std::random_device device;
//     std::mt19937 generator(device());
//     std::uniform_int_distribution<int> distribution(1,small);
//     cout << n << endl;
//     int amountSmall=n*frac;
//     int am1=(n-amountSmall)/classes;
//     double denominator=2.0;
//     int amountCtr=0;
//     for(int j=0; j<classes; j++)
//     {
//         for(int i=0; i<am1; i++)
//         {
//             int num1=distribution(generator);
//             int num2=distribution(generator);
//             cout << (int)((1/denominator+eps)*cap+num1) << " " << (int)((1/denominator+eps)*cap+num2) << endl;
//             amountCtr++;
//         }
//         denominator*=2;
//     }
//     for(int i=amountCtr; i<n; i++)
//     {
//         int num1=distribution(generator);
//         int num2=distribution(generator);
//         cout << num1 << " " << num2 << endl;
//     }
//     cout << cap << endl;
//     return 0;
// }



#include <iostream>
#include <random>
#include <cmath>
#include <vector>

using namespace std;

int main() {
    cerr << "n=" << endl;
    long long n;
    cin >> n;
    
    cerr << "capacity=" << endl;
    long long cap;
    cin >> cap;
    
    cerr << "classes=" << endl;
    int classes;
    cin >> classes;
    // 移除 classes-- 防止除零错误
    
    cerr << "frac=" << endl;
    double frac;
    cin >> frac;
    
    cerr << "eps=" << endl;
    double eps;
    cin >> eps;
    
    cerr << "small=" << endl;
    long long small;
    cin >> small;

    random_device device;
    mt19937 generator(device());
    uniform_int_distribution<long long> dist(1, small);

    cout << n << endl;
    
    // 计算各类物品数量
    int amountSmall = static_cast<int>(n * frac);
    int remaining = n - amountSmall;
    vector<int> classCounts(classes, remaining / classes);
    classCounts[0] += remaining % classes;  // 余数分配到第一类
    
    // 生成不同类别物品
    double denominator = 2.0;
    for (int j = 0; j < classes; j++) {
        for (int i = 0; i < classCounts[j]; i++) {
            long long base = static_cast<long long>((1.0/denominator + eps) * cap);
            long long num1 = base + dist(generator);
            long long num2 = base + dist(generator);
            cout << num1 << " " << num2 << endl;
        }
        denominator *= 2.0;
    }
    
    // 生成额外小物品
    for (int i = 0; i < amountSmall; i++) {
        cout << dist(generator) << " " << dist(generator) << endl;
    }
    
    cout << cap << endl;
    return 0;
}